package collection;

import java.util.ArrayList;
import java.util.Collection;

public class CollectionDemo4 {
    public static void main(String[] args) {
        Collection<Point> c = new ArrayList<>();
        Point p = new Point(1,2);
        c.add(p);//本质是将p变量保存的地址存入到集合中
        System.out.println("p:" + p);
        System.out.println("c:" + c);

        p.setX(2);
        System.out.println("p:" + p);
        System.out.println("c:" + c);//集合也看到了修改p后的效果

    }
}
